$(function() {
	$("#tech").accordion({
		active : 0,
		collapsible : true,
		header : "h2",
		autoHeight : false
	});
	$("button, input:submit, a", ".area").button().click(function() {
		runEffect(this.id);
		return false;
	});
	$("a", ".area").click(function() {
		return false;
	});

	// Tabs
	$('#tabs').tabs();

	// Dialog			
	$('#dialog').dialog({
		autoOpen : false,
		width : 600,
		buttons : {
			"Ok" : function() {
				$(this).dialog("close");
			},
			"Cancel" : function() {
				$(this).dialog("close");
			}
		}
	});

	// Dialog Link
	$('#dialog_link').click(function() {
		$('#dialog').dialog('open');
		return false;
	});

	// Datepicker
	$('#datepicker').datepicker({
		inline : true
	});

	// Slider
	$('#slider').slider({
		range : true,
		values : [ 17, 67 ]
	});

	// Progressbar
	$("#progressbar").progressbar({
		value : 20
	});

	//hover states on the static widgets
	$('#dialog_link, ul#icons li').hover(function() {
		$(this).addClass('ui-state-hover');
	}, function() {
		$(this).removeClass('ui-state-hover');
	});

	// run the currently selected effect
	function runEffect(id) {
		// get effect type from 
		var selectedEffect = 'transfer';

		// most effect types need no options passed by default
		var options = {};
		options = {
			to : "#effect",
			className : "ui-effects-transfer"
		};
		// run the effect
		$('#' + id).effect(selectedEffect, options, 500, callback);
	}
	;

	// callback function to bring a hidden box back
	function callback() {
		setTimeout(function() {
			//$("#effect").removeAttr("style").hide().fadeIn();
		}, 1000);
	}
	;
});

$(function() {
	$( "#panelheader" ).tabs();
	$( "#panelbody" ).tabs();
	$( "#panelfooter" ).tabs();
});